/**Variable**/
@import './helpers/mixin.scss';

%ButtonHover {
  color: lighten($vxe-primary-color, 6%);
  border-color: lighten($vxe-primary-color, 10%);
}

%ButtonPrimaryHover {
  color: #fff;
  background-color: lighten($vxe-primary-color, 4%);
  border-color: lighten($vxe-primary-color, 4%);
}

%ButtonInterval {
  margin-left: 10px;
  &.size--medium {
    margin-left: 8px;
  }
  &.size--small {
    margin-left: 6px;
  }
  &.size--mini {
    margin-left: 4px;
  }
}

.vxe-button {
  text-align: center;
  background-color: #fff;
  outline: 0;
  font-size: $vxe-font-size;
  white-space: nowrap;
  user-select: none;
  appearance: none;
  &[disabled] {
    color: $vxe-disabled-color;
    cursor: no-drop;
  }
  &:not([disabled]) {
    color: $vxe-font-color;
    cursor: pointer;
  }
  &.type--text {
    text-decoration: none;
    border: 0;
    background-color: transparent;
    &:not([disabled]) {
      &:hover {
        color: lighten($vxe-primary-color, 10%);
      }
    }
  }
  &.type--button {
    padding: 0 16px;
    line-height: 30px;
    border: 1px solid $vxe-input-border-color;
    border-radius: 4px;
    &.theme--primary {
      color: #fff;
      border-color: $vxe-primary-color;
      background-color: $vxe-primary-color;
      &:not([disabled]) {
        &:hover {
          @extend %ButtonPrimaryHover;
        }
        &:active {
          color: #fff;
          background-color: darken($vxe-primary-color, 2%);
          border-color: darken($vxe-primary-color, 2%);
        }
      }
    }
    &:not(.theme--primary) {
      &:not([disabled]) {
        &:hover {
          @extend %ButtonHover;
        }
        &:active {
          color: darken($vxe-primary-color, 2%);
          border-color: darken($vxe-primary-color, 2%);
        }
      }
    }
    &.size--medium {
      padding: 0 14px;
      line-height: 28px;
    }
    &.size--small {
      padding: 0 12px;
      line-height: 26px;
    }
    &.size--mini {
      padding: 0 10px;
      line-height: 24px;
    }
  }
  &+.vxe-button,
  &+.vxe-button--dropdown {
    @extend %ButtonInterval;
  }
  &.size--small,
  &.size--mini {
    font-size: 12px;
  }
}
.vxe-button--wrapper,
.vxe-button--dropdown {
  display: inline-block;
}
.vxe-button--dropdown {
  position: relative;
  &+.vxe-button,
  &+.vxe-button--dropdown {
    @extend %ButtonInterval;
  }
  &.is--active {
    & > .vxe-button {
      &.theme--primary {
        @extend %ButtonPrimaryHover;
      }
      &:not([disabled]) {
        &:not(.theme--primary) {
          @extend %ButtonHover;
        }
      }
    }
    .vxe-button--dropdown-wrapper {
      display: block;
    }
    .vxe-button--dropdown-arrow {
      transform: rotate(315deg);
      &.vxe-icon--arrow-bottom {
        margin-top: -2px;
      }
    }
  }
  .vxe-button--dropdown-arrow {
    font-size: 12px;
    margin-left: 5px;
    @include animatTransition(transform, .2s);
  }
  .vxe-button--dropdown-wrapper {
    display: none;
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
    margin-top: 5px;
    z-index: 100;
    padding: 5px;
    background-color: #fff;
    border-radius: 4px;
    border: 1px solid $vxe-input-border-color;
    box-shadow: 0 1px 6px rgba(0,0,0,.2);
    & > .vxe-button {
      margin: 0;
      display: block;
      width: 100%;
      border: 0;
      &.type--text {
        padding: 2px 8px;
      }
    }
  }
}